package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IHeartbeatApkConfigDao;
import org.jsbd.boss.domian.HeartbeatApkConfigBean;

import org.springframework.stereotype.Repository;

@Repository("heartbeatApkConfigDao")
public class HeartbeatApkConfigDaoImpl extends CrackBaseDao implements IHeartbeatApkConfigDao {

	@Override
	public void saveHeartbeatApkConfig(HeartbeatApkConfigBean heartbeatApkConfig) {
		super.insert("heartbeat_apk_config.insert_heartbeat_apk_config", heartbeatApkConfig);
	}

	@Override
	public void updateHeartbeatApkConfig(HeartbeatApkConfigBean heartbeatApkConfig) {
		super.insert("heartbeat_apk_config.update_heartbeat_apk_config", heartbeatApkConfig);
	}

	@Override
	public HeartbeatApkConfigBean getHeartbeatApkConfig(HeartbeatApkConfigBean heartbeatApkConfig) {
		return (HeartbeatApkConfigBean) super.queryForObject("heartbeat_apk_config.select_heartbeat_apk_config_one", heartbeatApkConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HeartbeatApkConfigBean> getHeartbeatApkConfigList(HeartbeatApkConfigBean heartbeatApkConfig) {
		return super.queryForList("heartbeat_apk_config.select_heartbeat_apk_config_list", heartbeatApkConfig);
	}

	@Override
	public Map<String, Object> getHeartbeatApkConfigListPage(DataGridModel page, HeartbeatApkConfigBean form) {
		form = (form == null ? new HeartbeatApkConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("heartbeat_apk_config.select_heartbeat_apk_config_page_count", form));
		results.put("rows", super.queryForList("heartbeat_apk_config.select_heartbeat_apk_config_list", form));
		return results;
	}

	@Override
	public Integer getHeartbeatApkConfigCount(HeartbeatApkConfigBean heartbeatApkConfig) {
		return super.queryForCount("heartbeat_apk_config.select_heartbeat_apk_config_page_count", heartbeatApkConfig);
	}

	public void deleteHeartbeatApkConfig(HeartbeatApkConfigBean heartbeatApkConfig){
		super.insert("heartbeat_apk_config.del_heartbeat_apk_config", heartbeatApkConfig);
	}
	
}
